package com.yjweb.webportal.mapper;

import com.yjweb.webportal.entities.Employee;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;

/**
 * Created by windMan on 2018/5/30
 * 接口类
 */
@Component
@Mapper
public interface EmployeeMapper {

    //查询分页
    List<Employee> getAllEmpInfo();

    //根据id获取数据
//    @Select("SELECT id,lastName,email,gender,birth FROM Employee WHERE id=#{id}")
    Employee getEmpById(Integer id);

    //插入单条数据
//    @Options(useGeneratedKeys = true,keyProperty = "id")
//    @Insert("INSERT INTO Employee(lastName,email,gender,birth) VALUES (#{lastName},#{email},#{gender},#{birth})")
    void insertEmp(Employee employee);

    //获取所有数据
//    @Select("SELECT id,lastName,email,gender,birth FROM Employee")
    Collection<Employee> getAllEmp();

    //根据id删除数据
//    @Delete("DELETE FROM  Employee WHERE id=#{id}")
    void deleteEmp(Integer id);

    //根据id修改数据
//    @Update("UPDATE Employee set lastName=#{lastName},email=#{email},gender=#{gender},birth=#{birth} WHERE id=#{id}")
    void updateEmp(Employee employee);
}
